package org.dzq.designmode.proxy.staticproxy;

import org.dzq.designmode.proxy.Animal;

/**
 * @ClassName: Proxy
 * @Package: org.dzq.designmode.proxy.staticproxy
 * @author: 越
 * @date: 2023/6/17 12:18
 * @Description: 静态代理，通过实现接口类并引入接口对象实现
 */
public class Proxy implements Animal {

    private Animal animal;

    public Proxy(Animal animal){
        this.animal = animal;
    }

    public void sleep(){
        System.out.println("吃饱了就睡");
    }

    @Override
    public void eat(String food) {
        animal.eat(food);
        sleep();
    }
}
